#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> mp(n + 1);
    for(int i = 1; i < n; i++) {
        cin >> a[i];
    }
    a[0] = 0;
    int f = -1;
    for(int i = 1; i < n; i++) {
        if(a[i] - a[i - 1] > n && f != -1) {
            cout << "NO" << endl;
            return;
        } else if(a[i] - a[i - 1] > n){
            f = a[i] - a[i - 1];
        }else{
            mp[a[i] - a[i - 1]]++;
        }
    } 
    vector<int> vec;
    for(int i = 1; i <= n; i++) {
        if(mp[i] > 2) {
            cout << "NO" << endl;
            return;
        }
        if(mp[i] > 1 && f != -1) {
            cout << "NO" << endl;
            return;
        }
        if(mp[i] > 1) {
            f = i;
        }
        if(mp[i] == 0) {
            vec.push_back(i);
        }
    }
    cout << vec.size() << endl;
    if(vec.size() == 1) {
        cout << "YES" << endl;
    } else if(f == vec[0] + vec[1]) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}

signed main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}